//gcc indexof.c share.dll
#include <stdio.h>
//#include "share.c"
/*
int indexof( char* src, char* str ) {
	char t='a';
	int i=-1;
	int m = 0;
	if( str[m]=='\0' ) return 0;
	while( i++, t!='\0' ){
		if( str[m]!='\0' ) {
			if( str[m]==src[i] ) m++;
			else if( m!=0 ) m = 0,i--;
		}else{
			return m>0 ? i-m : -1;
		}
		t=src[i+1];
	}
	return -1;
}
*/
int main(){
	char* s = "abcdcdefg";
	char* str = "cde";

	printf( "%d\n", indexof(s, str) );
	return 0;
}
